package net.sf.jOpinionPoll.entity;

import java.io.Serializable;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;

@Entity
@Table(name = "papel")
@NamedQueries({
        @NamedQuery(name = "Papel.findAll", query = "SELECT papel FROM Papel papel"),
        @NamedQuery(name = "Papel.count", query = "SELECT COUNT(papel) FROM Papel papel")
         })
public class Papel implements Serializable {
	private static final long serialVersionUID = 1L;
	
	private String tipoDePapel;
	
	public Papel() {
	}
    
	public Papel(String tipoDePapel) {
        this.tipoDePapel = tipoDePapel;
	}

	@Id
	public String getNome() {
		return tipoDePapel;
	}

	public void setNome(String tipoDePapel) {
        this.tipoDePapel = tipoDePapel;
	}

    @Transient
	public String getTipoDePapel() {
		return this.tipoDePapel;
	}
	
	public void setTipoDePapel(String tipoDePapel) {
		this.tipoDePapel = tipoDePapel;
	}
	
    /**
     * Returns a hash code value for the object.  This implementation computes
     * a hash code value based on the id fields in this object.
     * @return a hash code value for this object.
     */
    @Override
    public int hashCode() {
        return (getNome() != null ? getNome().hashCode() : 0);
    }
    
    @Override
	public boolean equals(Object o) {
    	if (o == null || !(o instanceof Papel))
            return false;

        if (getNome() != null)
	        return (getNome().equals(((Papel)o).getNome()));
        
        return this == o;
	}
    
	@Override
	public String toString() {
        return this.getClass().getName() + "[pk=" + getNome() + "]";
	}
}